// import { computed } from "vue";
import { useRoute } from "vue-router";
// import { AuthStore } from "@/stores/modules/auth";
import { getAuthButtonListApi } from "@/api/modules/login";

/**
 * @description 页面按钮权限
 * */
export const useAuthButtons = async (parentId?: string) => {
	const route = useRoute();
	if (parentId || (route && route.meta.id)) {
		const { result } = await getAuthButtonListApi({ parentId: parentId || (route.meta.id as string), type: "btn" });
		return result.records.children;
	} else {
		return [];
	}
	// console.log(result);
	// const authButtons: any = [];

	// 当前页按钮权限列表
	// const BUTTONS = computed(() => {
	// 	let currentPageAuthButton: { [key: string]: boolean } = {};
	// 	authButtons.forEach((item: any) => (currentPageAuthButton[item] = true));
	// 	return currentPageAuthButton;
	// });
	// return {
	// 	BUTTONS
	// };
};
